{include file="header.html"}

<div class="page-header">
	<h6>
		广告管理
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			广告列表
		</small>
	</h6>
</div>

<form class="form-inline" action="?" method="get">
<input type="hidden" name="app" id="app" value="ad" />
<input type="hidden" name="act" id="act" value="index" /> 
<input type="text" name="keyword" value="{$keyword}" placeholder="关键词" /> 
<input type="text" class="form-control" name="begin_time" id="begin_time" placeholder="开始时间" value="{$begin_time}" initdate="" style="width:100px;" />
<span class="some-span">-</span>
<input type="text" class="form-control" name="end_time" id="end_time" placeholder="结束时间" value="{$end_time}" initdate="" style="width:100px;" /> 
<select name="ad_type" id="ad_type" class="form-control">
	<option value="">类型</option>
	{foreach from=$types item=g}
	<option value="{$g->name}" {if $ad_type==$g->name}selected{/if}>{$g->value}</option>
	{/foreach}
</select> 
<select name="position" id="position" class="form-control">
	<option value="">位置</option>
	{foreach from=$positions item=g}
	<option value="{$g->name}" {if $position==$g->name}selected{/if}>{$g->value}</option>
	{/foreach}
</select> 	
<button type="submit" class="btn btn-info btn-sm">
	<i class="ace-icon fa fa-search bigger-110"></i>搜索
</button>
</form>

<div class="table-content">
<table id="simple-table" class="table table-striped table-bordered table-hover">
	<thead>
		<tr>
			<th>ID</th>
			<th>图片</th>
			<th>广告名称</th>
			<th>类型</th>
			<th>内容</th>
			<th>位置</th>
			<th>开始时间</th>
			<th>结束时间</th>
			<th>操作</th>
		</tr>
	</thead>

	<tbody>
		{foreach from=$rs item=row name=row}
		<tr>
			<td>{$row.id}</td>
			<td style="text-align:center;">
				<a href="?app=ad&act=edit&id={$row.id}"><img src="{if $row.pic !== ''}{$row.pic}{else}/images/nopic.png{/if}" width="100" /></a>
			</td>
			<td>
				<a href="?app=ad&act=edit&id={$row.id}">{$row.name}</a>
			</td>
			<td>{$row.ad_type}</td>
			<td>{$row.ad_content}</td>
			<td>{$row.position}</td>
			<td>{if $row.begin_time}{$row.begin_time|date_format:"%Y-%m-%d %H:%I"}{/if}</td>
			<td>{if $row.end_time}{$row.end_time|date_format:"%Y-%m-%d %H:%I"}{/if}</td>
			<td>
				<a href="?app=ad&act=edit&id={$row.id}">
					<button type="button" class="btn btn-xs btn-info">
					<i class="ace-icon fa fa-pencil bigger-120"></i>
				</button>
				</a>
				<a href="?app=ad&act=delete&id={$row.id}" class="delete">
					<button type="button" class="btn btn-xs btn-danger">
					<i class="ace-icon fa fa-trash-o bigger-120"></i>
				</button>
				</a>
			</td>
		</tr>
		{foreachelse}
		<tr bgcolor="white"><td colspan="13" height="50">暂无记录</td></tr>
		{/foreach}	
		
	</tbody>
</table>
</div>
<div class="mypage">
	共 {$page.num_records} 个记录  {$page.current_page} / {$page.num_pages} 页  {$page.first_page} {$page.prev} {$page.nav} {$page.next} {$page.last_page}
</div>

{include file="footer.html"}
<script>
$(function(){
	$('#begin_time').datepicker();
	$('#end_time').datepicker();
});
</script>